<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/14
 * Time: 15:57
 */

namespace app\commands;


use yii\db\Query;
use yii;
use yii\console\Controller;

class CustomerController extends Controller
{
    /**
     * 重构跟进人
     */
    public function actionUpdateFollow()
    {
        $db = new Query();
        $list = $db->select('*')->from('jingsourcing_customer')->all();
        foreach ($list as $v) {
            $job_number = \json_decode($v['follow_man'],true);
            if (is_array($job_number)){
                foreach ($job_number as $v2) {
                    yii::$app->db->createCommand()->insert('jingsourcing_customer_follow',['customer_id'=>$v['id'],'job_number'=>$v2])->execute();
                }
            }
        }
    }
}